name: Run tests

on:
  pull_request:
    branches:
      - master

concurrency:
  # For pull requests, cancel all currently-running jobs for this workflow
  # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

jobs:
  tests:
    name: integration test
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Setup .NET SDK
        uses: actions/setup-dotnet@v3
        with:
          # Semantic version range syntax or exact version of a dotnet version
          dotnet-version: '6.0.x'
      - name: Install dependencies
        run: dotnet restore
      - name: Build
        run: dotnet build --configuration Release --no-restore
      - name: Test
        env:
          ENV_SERVER_URL: ${{secrets.ENV_SERVER_URL}}
          ENV_PROJECT_NAME: ${{secrets.ENV_PROJECT_NAME}}
          ENV_PAT: ${{secrets.ENV_PAT}}
        run: dotnet test --no-restore --verbosity normal